/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.tomasio.projects.welcome;

import com.tomasio.projects.welcome.interfaces.AutorizacaoService;
import com.tomasio.projects.welcome.interfaces.CartaoService;
import com.tomasio.projects.welcome.interfaces.MovimentacaoService;
import com.tomasio.projects.welcome.interfaces.ProibicaoService;
import com.tomasio.projects.welcome.interfaces.ServiceFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *
 * @author administrador
 */
public class SimpleServiceFactory implements ServiceFactory{
    ApplicationContext context = new ClassPathXmlApplicationContext("spring-core-context.xml");

    @Override
    public AutorizacaoService getAutorizacaoService() {
        return (AutorizacaoService) context.getBean("autorizacaoService");
    }

    @Override
    public MovimentacaoService getMovimentacaoService() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public CartaoService getCartaoService() {
        return (CartaoService) context.getBean("cartaoService");
    }
    @Override
    public ProibicaoService getProibicaoService() {
        return (ProibicaoService) context.getBean("proibicaoService");
    }
}
